001 /* 002 * Copyright 2005 Stephen McConnell 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 013 * implied. 014 * 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package net.dpml.station; 020 021 import java.net.URI; 022 import java.rmi.Remote; 023 import java.rmi.RemoteException; 024 import java.io.IOException; 025 026 import net.dpml.station.info.ApplicationDescriptor; 027 import net.dpml.station.info.RegistryDescriptor; 028 029 import net.dpml.lang.UnknownKeyException; 030 import net.dpml.lang.DuplicateKeyException; 031 032 /** 033 * Registry of application profiles. 034 */ 035 public interface ApplicationRegistry extends Remote 036 { 037 /** 038 * The default storage uri. 039 */ 040 static final URI DEFAULT_STORAGE_URI = RegistryDescriptor.DEFAULT_STORAGE_URI; 041 042 /** 043 * Return the array of application keys. 044 * @return the application key array 045 * @exception RemoteException if a transport error occurs 046 */ 047 String[] getKeys() throws RemoteException; 048 049 /** 050 * Return the number of application descriptors in the registry. 051 * @return the application descriptor count 052 * @exception RemoteException if a transport error occurs 053 */ 054 int getApplicationDescriptorCount() throws RemoteException; 055 056 /** 057 * Return an array of all profiles in the registry. 058 * @return the application profiles 059 * @exception RemoteException if a transport error occurs 060 */ 061 ApplicationDescriptor[] getApplicationDescriptors() throws RemoteException; 062 063 /** 064 * Add an application descriptor to the registry. 065 * @param key the application key 066 * @param descriptor the application descriptor 067 * @exception DuplicateKeyException if the key is already assigned 068 * @exception RemoteException if a transport error occurs 069 */ 070 void addApplicationDescriptor( String key, ApplicationDescriptor descriptor ) 071 throws DuplicateKeyException, RemoteException; 072 073 /** 074 * Get an application descriptor matching the supplied key. 075 * @param key the application key 076 * @return the application descriptor 077 * @exception UnknownKeyException if the key is unknown 078 * @exception RemoteException if a transport error occurs 079 */ 080 ApplicationDescriptor getApplicationDescriptor( String key ) 081 throws UnknownKeyException, RemoteException; 082 083 /** 084 * Replace an application descriptor within the registry with a supplied descriptor. 085 * @param key the application key 086 * @param descriptor the updated application descriptor 087 * @exception UnknownKeyException if the key is unknown 088 * @exception RemoteException if a transport error occurs 089 */ 090 void updateApplicationDescriptor( String key, ApplicationDescriptor descriptor ) 091 throws UnknownKeyException, RemoteException; 092 093 /** 094 * Remove an application descriptor from the registry. 095 * @param key the application key 096 * @exception UnknownKeyException if the key is unknown 097 * @exception RemoteException if a transport error occurs 098 */ 099 void removeApplicationDescriptor( String key ) 100 throws UnknownKeyException, RemoteException; 101 102 /** 103 * Add a registry change listener. 104 * @param listener the registry change listener to add 105 * @exception RemoteException if a transport error occurs 106 */ 107 void addRegistryListener( RegistryListener listener ) throws RemoteException; 108 109 /** 110 * Remove a registry change listener. 111 * @param listener the registry change listener to remove 112 * @exception RemoteException if a transport error occurs 113 */ 114 void removeRegistryListener( RegistryListener listener ) throws RemoteException; 115 116 /** 117 * Request externalization of the registry state. 118 * @exception IOException if an I/O error occurs 119 * @exception RemoteException if a transport error occurs 120 */ 121 void flush() throws IOException, RemoteException; 122 } 123